<!DOCTYPE html>
<html lang="ch-CN">
<head>
    <meta charset="UTF-8">
    <title>for-打印质数</title>
</head>
<style>
    body {
        width: 100%;
        height: 100vh;
        background-color: wheat;
        font-size: 30px;
        text-decoration: none;
        font-family: "华文楷体";
    }
</style>
<body>
</body>
<script>
    // 指定退出外部的循环
    outer:
    for (let i = 0; i <= 50; i++) {
        document.write("外部循环"+i)
        for (let j = 0; j < 5; j++) {
            if (j===3){
                break outer
            }
            document.write("内部循环"+j)
        }
    }
    document.write("<br>")
    document.write("<br>")
        // 退出离break最近的循环
        for (let i = 0; i <= 5; i++) {
            for (let j = 0; j < 5; j++) {
                if (j===3){
                    break
                }
                document.write("内部循环"+j)
            }
        }
    document.write("<br>")
    document.write("<br>")
    // 退出离continue最近的本次循环
    for (let i = 0; i <= 5; i++) {
        for (let j = 0; j < 5; j++) {
            if (j===3){
                continue
            }
            document.write("内部循环"+j)
        }
    }
</script>
</html>